package com.pickgliss.utils
{
	import com.pickgliss.ui.ComponentFactory;
	
	import flash.display.DisplayObject;
	import flash.geom.Point;
	
	public class PositionUtils
	{
		/**
		 *设置位置,如果将<b>posObject</b>具有<b>x</b>和<b>y</b>属性,将<b>posObject</b>的<b>x</b>和<b>y</b>属性赋值给<b>obj</b>的<b>x</b>和<b>y</b>,
		 * 如果<b>posObject</b>为<b>RoadComponent</b>样式,则创建<b>posObject</b>并将其<b>x</b>和<b>y</b>属性赋值给<b>obj</b>的<b>x</b>和<b>y</b>
		 * @param obj
		 * @param posObject
		 * @return 
		 * 
		 */		
		public static function setPos(obj:*,posObject:*):*{
			if(posObject is String){
				var pos:Point = ComponentFactory.Instance.creatCustomObject(posObject);
				obj.x = pos.x;
				obj.y = pos.y;
			}else if(posObject is Object){
				obj.x = posObject.x;
				obj.y = posObject.y;
			} 
			return obj;
		}
		
		public static function creatPoint(pointStyle:String):Point
		{
			var point:Point = ComponentFactory.Instance.creatCustomObject(pointStyle);
			return point;
		}
	}
}